package cn.edu.qut.edusys.controller;


import cn.edu.qut.edusys.mapper.ManagerMapper;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.Objects;

@RestController
@RequestMapping("/manager")
@ResponseBody
public class managerController {

    @Resource
    private ManagerMapper managermapper;

    //完整访问路径； manager/Search
    @RequestMapping("/Search")
    public List<Map<String,Object>> Search(@RequestParam Map<String,String> param){
        List<Map<String,Object>> list=null;
        list=managermapper.search(param);
        return list;
    }

    @RequestMapping("/Search_subjectNum")
    public List<Map<String,Object>> Search_subjectNum(@RequestParam Map<String,String> param){
        List<Map<String,Object>> list=null;
        list=managermapper.search_subjectNum(param);
        return list;
    }

    @RequestMapping("/Add")
    public int Add(@RequestParam Map<String,String> param){
        int row=0;
        System.out.println(param);
        //调用接口中的方法
        row=managermapper.add(param);
        return row;
    }

    @RequestMapping("/Update")
    public int Update(@RequestParam Map<String,String> param){
        int row=0;
        System.out.println(param);
        //调用接口中的方法
        row=managermapper.update(param);
        return row;
    }

    @RequestMapping("/Delete")
    public int batchDelete(String[] ids){
        int row=0;
        row=managermapper.delete(ids);
        return row;
    }

    @RequestMapping("/Delete_users")
    public int Delete_users(String[] ids){
        int row=0;
        row=managermapper.delete_users(ids);
        return row;
    }

    @RequestMapping("/search_users")
    public List<Map<String,Object>> Search_users(@RequestParam Map<String,String> param){
        List<Map<String,Object>> list=null;
        list=managermapper.search_users(param);
        return list;
    }
}
